// import ajax from '@/utils/request.js'
import { ajax } from '@/plugins/request.js'

/**
 * @description 获取文章列表
 */
export const getArticles = (data) => {
  return ajax.get(`/api/articles`, {
    params: data
  })
}

/**
 *
 * @description 获取tags
 */
export const getTags = (params) => {
  return ajax.get(`/api/tags`, {
    params
  })
}

export const getYourFeedArticle = (params) => {
  return ajax.get(`/api/articles/feed`, {
    params
  })
}

export const addFavorite = (slug) => {
  return ajax.post(`/api/articles/${slug}/favorite`)
}

export const deleteFavorite = (slug) => {
  return ajax.delete(`/api/articles/${slug}/favorite`)
}
